home *** CD-ROM | disk | FTP | other *** search
/ Crosscountry USA Photo Safari / Crosscountry USA Photo Safari.iso / Data / cc_base / pak00_16bit_f.pk3 / common / set_cur_state.c4 < prev    next >
Text File  |  2002-12-18  |  1KB  |  47 lines

  1.       
  2. {
  3.   @set_cur_state {
  4.     resid city_data_id;
  5.     resid state_data_id;
  6.     resid Player;
  7.     resid Game;
  8.     resid csv_data_id;
  9.  
  10.     str nav_cur_city;
  11.     
  12.     int city_row;
  13.     str state_abrev;
  14.     int state_row_num;
  15.     str state_name;
  16.     
  17.     Game = ResByName("Game");
  18.     Player = ResPropGetResID(Game,"game_cur_player");
  19.  
  20.     csv_data_id = ResByName("CSVData");
  21.     city_data_id = ResPropGetResID(csv_data_id, "city_id");
  22.     state_data_id = ResPropGetResID(csv_data_id, "state_id");
  23.     
  24.     nav_cur_city = ResPropGetStr(Player,"nav_cur_city");
  25.  
  26.     /* get the city row */
  27.     city_row = CSVSearch(city_data_id,"name",nav_cur_city);  
  28.  
  29.     /* get the state abbreviation */
  30.     state_abrev = CSVGetStr(city_data_id,"state",city_row);
  31.  
  32.     /* search for the state rownum */
  33.     state_row_num = CSVSearch(state_data_id,"abbreviation",state_abrev); 
  34.  
  35.     /* get the state name */
  36.     state_name = CSVGetStr(state_data_id,"name",state_row_num);          
  37.  
  38.     /* update the player nav_cur_state */
  39.     ResPropSetStr(Player,"nav_cur_state",state_name);
  40.  
  41.     /* update the player nav_cur_state_row_num */
  42.     ResPropSetInt(Player,"nav_cur_state_row_num",state_row_num);
  43.  
  44.   }    
  45. }      
  46.       
  47.